<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录页面</title>
<script type="text/javascript">
	//表单验证
	function check(form) {
		var usernameValue = trim(form.username.value)
		var passwordValue = trim(form.password.value)
		if (usernameValue == "") {
			alert("用户名不能为空！");
			form.username.value = "";
			form.username.focus();
			return false;
		}
		if (passwordValue == "") {
			alert("密码不能为空！");
			form.password.value = "";
			form.password.focus();
			return false;
		}
		return true;
	}
	//去左右空格;
	function trim(s){
	    return s.replace(/(^\s*)|(\s*$)/g, "");
	}
</script>
</head>
<body>
	<form action="login.do" style="text-align: center;" method="post">
		用户名：<input type="text" name="username">
		密码：<input type="password" name="password">
		<input type="submit" value="提交" onclick="return check(this.form);">
	</form>
</body>
</html>
